From efa8956718386b29ecd37aa11e1a827656b66616 Mon Sep 17 00:00:00 2001 From: Simon Feltman Date: Fri, 16 Aug 2013 03:59:30 -0700 Subject: [PATCH] Add introspection friendly version of gtk_tree_path_new_from_indices Add gtk_tree_path_new_from_indicesv which takes an array of integers with a length. Use "Rename to" annotation to rename the method as gtk_tree_path_new_from_indices. This is needed because the original method takes variadic arguments which is not supported by introspection. https://bugzilla.gnome.org/show_bug.cgi?id=706119 --- docs/reference/gtk/gtk3-sections.txt | 1 + gtk/gtktreemodel.c | 28 ++++++++++++++++++++++++++++ gtk/gtktreemodel.h | 3 +++ 3 files changed, 32 insertions(+) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index aaa9c8e630..d4fe0cb82c 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -4244,6 +4244,7 @@ GtkTreeModelFlags gtk_tree_path_new gtk_tree_path_new_from_string gtk_tree_path_new_from_indices +gtk_tree_path_new_from_indicesv gtk_tree_path_to_string gtk_tree_path_new_first gtk_tree_path_append_index diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c index 1a8a9fc94a..b5190013db 100644 --- a/gtk/gtktreemodel.c +++ b/gtk/gtktreemodel.c @@ -681,6 +681,34 @@ gtk_tree_path_new_from_indices (gint first_index, return path; } +/** + * gtk_tree_path_new_from_indicesv: (rename-to gtk_tree_path_new_from_indices) + * @indices: (array length=length): array of indices + * @length: length of @indices array + * + * Creates a new path with the given @indices array of @length. + * + * Return value: A newly created #GtkTreePath + * + * Since: 3.12 + */ +GtkTreePath * +gtk_tree_path_new_from_indicesv (gint *indices, + gsize length) +{ + GtkTreePath *path; + + g_return_val_if_fail (indices != NULL && length != 0, NULL); + + path = gtk_tree_path_new (); + path->alloc = length; + path->depth = length; + path->indices = g_new (gint, length); + memcpy (path->indices, indices, length * sizeof (gint)); + + return path; +} + /** * gtk_tree_path_to_string: * @path: A #GtkTreePath diff --git a/gtk/gtktreemodel.h b/gtk/gtktreemodel.h index e1ebde52b8..a1cccc2c8a 100644 --- a/gtk/gtktreemodel.h +++ b/gtk/gtktreemodel.h @@ -167,6 +167,9 @@ GtkTreePath *gtk_tree_path_new_from_string (const gchar *path); GDK_AVAILABLE_IN_ALL GtkTreePath *gtk_tree_path_new_from_indices (gint first_index, ...); +GDK_AVAILABLE_IN_3_12 +GtkTreePath *gtk_tree_path_new_from_indicesv (gint *indices, + gsize length); GDK_AVAILABLE_IN_ALL gchar *gtk_tree_path_to_string (GtkTreePath *path); GDK_AVAILABLE_IN_ALL -- 2.30.2